/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task08.task0816;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/* 
善良的艾玛和暑假
*/

public class Solution {
    public static HashMap<String, Date> createMap() throws ParseException {
        DateFormat df = new SimpleDateFormat("MMMMM d yyyy", Locale.ENGLISH);
        HashMap<String, Date> map = new HashMap<String, Date>();
        map.put("史泰龙", df.parse("JUNE 1 1980"));
        map.put("Steve Jobs", df.parse("FEBRUARY 24 1955"));
        map.put("Elon Musk", df.parse("JUNE 28 1971"));
        map.put("Steve Rogers", df.parse("JULY 4 1918"));
        map.put("Anthony Stark", df.parse("MAY 29 1970"));

        map.put("Howard Stark", df.parse("AUGUST 15 1917"));
        map.put("Peter Parker", df.parse("AUGUST 10 2002"));
        map.put("Stephen Strange", df.parse("JULY 3 1930"));
        map.put("Bucky Barnes", df.parse("MARCH 10 1917"));
        map.put("Nick Fury", df.parse("JULY 4 1950"));
        return map;
        //在此编写你的代码

    }

    public static void removeAllSummerPeople(HashMap<String, Date> map) {
        //在此编写你的代码
        Iterator<Map.Entry<String, Date>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Date> pair = iterator.next();
            Date date = pair.getValue();
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            int month = cal.get(Calendar.MONTH);

            if ((month >= 5) && (month <= 7)) {
                iterator.remove();
            }
        }
    }

    public static void main(String[] args) {

    }
}
